package model.MatriceCreuseOBSOLETE;

import java.awt.Point;
import java.awt.event.ActionListener;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Observer;

import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.EventListenerList;

import model.DefaultModel;
import model.ModelListener;
import model.PointControl;

public class Model extends  DefaultModel {


	private static final long serialVersionUID = 1L;

	MatriceCreuse matrice;

	public Model() {
		super();
		matrice = new MatriceCreuse();
	}

	/* (non-Javadoc)
	 * @see model.InterfaceModel#add(java.awt.Point)
	 */
	public void add(Point destination) {
		super.add(destination);
		matrice.add(destination);


	}



	/* (non-Javadoc)
	 * @see model.InterfaceModel#isOverPoint(java.awt.Point)
	 */
	public boolean isOverPoint(Point a) {
		return matrice.isOverPoint(a);
	}

	/* (non-Javadoc)
	 * @see model.InterfaceModel#remove(model.PointControl)
	 */
	public void remove(PointControl removedPoint) {
		super.remove(removedPoint);
		matrice.remove(removedPoint);
		// TODO supprimer de la courbe courante
	}

	/* (non-Javadoc)
	 * @see model.InterfaceModel#movePoint(java.awt.Point, java.awt.Point)
	 */
	public void movePoint(Point origine, Point destination) {
		super.movePoint(origine, destination);
		matrice.add(destination);
		matrice.remove(origine);
	}


	
	private void printMatrice(){
		System.out.println("Dump : ");
		matrice.printMySelf();
	}

}
